<html>
<body>
<?php 
$dbuser = 'cs3380sp11grp2';
$dbpass = 'rHJmBSWL';
$dbname = 'dbase1';

  // Get the search variable from URL

  $TYPE = @$_GET['TYPE'] ;
  $VALUE = @$_GET['VALUE'];
  $TYPEtrim = trim($TYPE); //trim whitespace from the stored variable
  $VALUEtrim = trim($VALUE);
if ($VALUEtrim == "")
{$VALUE = '%';}



            // try connecting to the database
    $dbconn = oci_connect($dbuser, $dbpass, $dbname);

    // check for any errors
    if (!$dbconn)
    {
     $e = oci_error();
     print htmlentities($e['message']);
     exit;
    }

    echo $VALUE;
	echo $TYPE;
//Form query
$query = "SELECT USERNAME, ADDRESSCITY, ADDRESSSTATE FROM USERS WHERE USERNAME LIKE '$VALUE'";
//Prepare and execute query
$parsed = oci_parse($dbconn, $query);
oci_execute($parsed);
// Fetch results
$nrows = oci_fetch_all($parsed, $results);
//Display results
echo "<table border=1>\n";
for($i = 0; $i<$nrows; $i++)
{
$name = $results['USERNAME'][$i];
$pop = $results['ADDRESSCITY'][$i];
$state = $results['ADDRESSSTATE'][$i];
echo "<tr>\n";
echo "<td>$name</td>\n";
echo "<td>$pop</td>\n";
echo "<td>$state</td>\n";
echo "</tr>\n";
}
echo "</table>\b";

//Free result set
oci_free_statement($parsed);
//Close database connection
oci_close($dbconn);
?>
</center>
